import Vue from 'vue'
import App from './App.vue'
import router from './router'

// reset.css
import './assets/style/reset.css'

import './util/rem'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

import VueAwesomeSwiper from 'vue-awesome-swiper';
import 'swiper/css/swiper.css';
Vue.use(VueAwesomeSwiper, /* { default global options } */ )

import VideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
Vue.use(VideoPlayer)

// 引入所有api
import API from './api/api'
Vue.prototype.$http = API

// 路由发生变化修改页面title
router.beforeEach((to, from, next) => {
  // console.log('tab', to.meta)
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

// 路由跳转页面回到顶部
router.afterEach((to, from, next,window) => {
  window,
  scrollTo(0, 0)
})

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')